﻿<%@ page language="java" contentType="text/html;charset=utf-8" pageEncoding="utf-8"%>

<%@ include file="/core/taglibs.jsp"%>
<!DOCTYPE html>
<html lang="en" class="app">
<head>
	<meta charset="utf-8" />
	<title>紅花（香港）集團-众艾车代理商管理系统</title>
	<meta name="description" content="app, web app, responsive, admin dashboard, admin, flat, flat ui, ui kit, off screen nav" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
	<%@ include file="/core/memberZong.jsp" %>
	<script type="text/javascript" src="<%=basePath%>/resources/js/jquery-1.4.js"></script>
	<link href="<%=basePath%>/resources/js/zTree/zTreeStyle.css" rel="stylesheet"/>
	<script src="<%=basePath%>/resources/js/zTree/jquery.ztree-2.6.min.js" type="text/javascript"></script>

	<script type=text/javascript>
        var zTree ;
        var setting;
        var zNodes =[];

        setting = {

            async: true,

            isSimpleData : true,
            treeNodeKey : "id",
            treeNodeParentKey : "fatherId",

            //访问路径
            asyncUrl: "<%=basePath%>/member/member/ajaxTuRecommend.shtml",    				//获取节点数据的URL地址
            asyncParam: ["id"],        	     						//获取节点数据时，必须的数据名称，例如：id、name
            asyncParamOther: ["loginName","${loginName}"],        	//其它参数 ( key, value 键值对格式)
            callback:{
                asyncSuccess: zTreeOnAsyncSuccess,
                expand: zTreeOnExpand
            }
        };



        $(document).ready(function(){

            refreshTree();
        });

        //异步返回的数据
        function zTreeOnAsyncSuccess(event, treeId, treeNode, msg) {

            zTree.expandNode(treeNode, false, false,false);
        }

        //刷新数据
        function refreshTree(asyncUrl) {

            setting.asyncUrl = "<%=basePath%>/member/member/ajaxTuRecommend.shtml";
            setting.asyncDataFilter = dataFilter;

            zTree = $("#recommendTree").zTree(setting, zNodes);

        }

        //数据过滤
        function dataFilter(treeId, parentNode, childNodes) {
            childNodes=childNodes.menuList;

            return childNodes;
        }




        //展开的时候增加孙子
        function zTreeOnExpand(event, treeId, treeNode) {

            var nodes = zTree.getNodesByParam("fatherId", treeNode.id, treeNode);

            for(var i =0; i<nodes.length; i++) {
                if(nodes[i].childNum>0){
                    nodes[i].isParent=true;
                    zTree.updateNode(nodes[i])
                    zTree.reAsyncChildNodes(nodes[i], "refresh");
                }else{
                    nodes[i].isParent=false;
                }


            }
        }
	</script>

</head>
<body>
<section class="vbox">
	<section>
		<section class="hbox stretch">
			<section id="content1">
				<section class="vbox">
					<section class="scrollable padder">

						<div class="m-b-md">
							<h3 class="m-b-none">直推图</h3>
						</div>
						<section class="panel panel-default">
							<header class="panel-heading"> 直推图 </header>

							<div class="table-responsive">

								<%--<div id="hidden-table-info_wrapper" class="dataTables_wrapper form-inline" role="grid">--%>

									<div class="am-scrollable-horizontal ">
										<div id="recommendTree" class="tree" style="color: white;"></div>
									</div>
									<iframe id="show" name="show" src="<%=basePath%>/member/member/tuRecommendShow.shtml?loginName=${loginName}" frameborder="0"
											width="100%" height="100%" scrolling="no"/>

								<%--</div>--%>
							</div>


						</section>
					</section>
				</section>

			</section>
		</section>
	</section>

</section>
</body>
</html>